﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace chapter_3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            
             
        }

        protected override void OnLoad(EventArgs e)
        {
            string msg = this.ClientRectangle.ToString();
            msg += "\n";
            msg += this.DisplayRectangle.ToString();
            msg += this.Location.ToString();
            //MessageBox.Show(msg);
            base.OnLoad(e);
        }

        private void loadLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Title = "Load Photo";
            dlg.Filter = "jpg files (*.jpg)|*.jpg|All files(*.*)|*.*";

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    pictureBox1.Image = new Bitmap(dlg.OpenFile());
                }
                catch (ArgumentException ex)
                {
                    MessageBox.Show("Unable to load file" + ex.Message);
                }
            }
        }

        private void fileFToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void ExitToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }
    }
}
